home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.3 (Developer)…68k, x86, SPARC, PA-RISC] / NeXTSTEP 3.3 Dev Intel.iso / NextDeveloper / Headers / driverkit / kernelDriver.h < prev    next >
Text File  |  1993-08-21  |  2KB  |  105 lines

  1. /*     Copyright (c) 1991 NeXT Computer, Inc.  All rights reserved. 
  2.  *
  3.  * kernelDriver.h - kernel-only driverkit functions.
  4.  *
  5.  * HISTORY
  6.  * 12-Jul-91    Doug Mitchell at NeXT
  7.  *      Created. 
  8.  */
  9.  
  10. #ifdef    KERNEL
  11.  
  12. #import <objc/objc.h>
  13. #import <driverkit/driverTypes.h>
  14. #import <mach/mach_types.h>
  15. #import <sys/buf.h>
  16.  
  17. /*
  18.  * The functions defined here are not RPC's; they are functions available
  19.  * only to drivers in the kernel.
  20.  */
  21.  
  22. /*
  23.  * Get id of specified IODeviceName.  Returns IO_R_NOTATTACHED if 
  24.  * deviceName not found, else returns IO_R_SUCCESS.
  25.  */
  26. IOReturn IOGetObjectForDeviceName(
  27.     IOString deviceName,
  28.     id *deviceId);                // returned
  29.  
  30. /*
  31.  * Returns the kernel's vm_task_t.
  32.  */
  33. vm_task_t IOVmTaskSelf();
  34.  
  35. /*
  36.  * Returns the current task's vm_task_t.
  37.  */
  38. vm_task_t IOVmTaskCurrent();
  39.  
  40. /*
  41.  * Returns vm_task_t associated with a struct buf. 
  42.  */
  43. vm_task_t IOVmTaskForBuf(struct buf *buffer);
  44.  
  45. /*
  46.  * Set the current thread's UNIX errno.
  47.  */
  48. void IOSetUNIXError(int errno);
  49.  
  50. /* 
  51.  * Convert between a port in a loadable kernel server's IPC space, an 
  52.  * I/O task port, and a kernel internal port. 
  53.  */
  54. typedef enum {
  55.     IO_Kernel,            // a kernel internal port
  56.     IO_KernelIOTask,        // a port in the kernel I/O task
  57.     IO_CurrentTask            // a port in a loadable kernel server
  58. } IOIPCSpace;
  59.  
  60. /*
  61.  * Returns PORT_NULL on error.
  62.  */
  63. port_t IOConvertPort(port_t inPort,    // to be converted
  64.     IOIPCSpace from,        // IPC space of inPort
  65.     IOIPCSpace to);            // IPC space of returned port
  66.  
  67. /*
  68.  * Obtain the IOTask version of host_priv_self() (the privileged host port).
  69.  */
  70. port_t IOHostPrivSelf();
  71.  
  72. /*
  73.  * Find a physical address (if any) for the specified virtual address.
  74.  * Returns IO_R_INVALID_ARG if no virtual-to-physical mapping exists,
  75.  * else returns IO_R_SUCCESS.
  76.  * For IOTask virtual addresses, use IOVmTaskSelf() for the 'task'
  77.  * argument. 
  78.  * This function may block on some architectures.
  79.  */
  80. IOReturn IOPhysicalFromVirtual(vm_task_t task, 
  81.     vm_address_t virtualAddress,
  82.     unsigned *physicalAddress);
  83.  
  84. /*
  85.  * Create a mapping in the IOTask address map
  86.  * for the specified physical region.  Assumes
  87.  * that the physical memory is already wired.
  88.  */
  89. IOReturn
  90. IOMapPhysicalIntoIOTask(
  91.     unsigned        physicalAddress,
  92.     unsigned        length,
  93.     vm_address_t    *virtualAddress);
  94.  
  95. /*
  96.  * Destroy a mapping created by
  97.  * IOTaskCreateVirtualFromPhysical()
  98.  */
  99. IOReturn
  100. IOUnmapPhysicalFromIOTask(
  101.     vm_address_t    virtualAddress,
  102.     unsigned        length);
  103.  
  104. #endif    KERNEL
  105.